/*
 * RealSelector.java
 * 
 * last update: 24.01.2010 by Olaru Victor
 * 
 * author:	Victor(victor.olaru@gmail.com)
 * 
 * Obs:
 */

package engine;

class RealSelector extends Expression implements LeftValue{

	Real r;
	GenericSelectorDescription desc;

	public RealSelector(NameSpace ns, Real r, GenericSelectorDescription desc){
		super(ns);
		this.r = r;
		this.desc = desc;
		length = 64;  //Real is seen as double
	}

	public void addMonitor(Monitor m){
		r.addMonitor(m);
	}

	public void assign(Result result)throws InterpretTimeException{
		try{
			r.attrib(result.getReal());
		}catch(Exception e){
			throw new InterpretTimeException("invalid attribution: " + r + " = " + r);
		}
	}

	public Result evaluate(){
		return new Real(r);
	}

	public String toString(){
		return desc.toString();
	}

	public int length() {
		return length;
	}
}






